package com.xin.di.uav.applet.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xin.di.uav.po.OrderCommodity;
import com.xin.di.uav.applet.service.IOrderCommodityService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 订单商品关联表 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-12-12
 */
@RestController
public class OrderCommodityRest {

    @Autowired
    private IOrderCommodityService iOrderCommodityService;

    @ApiModelProperty(value = "通过订单号查询")
    public List<OrderCommodity> getByOrderSn(@RequestParam String orderSn) {
        return iOrderCommodityService.getByOrderSn(orderSn);
    }


    @ApiModelProperty(value = "通过订单号查询")
    public List<OrderCommodity> getByOrderSns(@RequestParam List<String> orderSns) {
        return iOrderCommodityService.getByOrderSns(orderSns);
    }

    public List<OrderCommodity> getOrderCommodityInCommodityIds(@RequestParam Set<String> commodityIds) {
        return iOrderCommodityService.list(new QueryWrapper<OrderCommodity>().in("commodity_id",commodityIds));
    }
}
